// To parse this JSON data, do
//
//     final userInfoModel = userInfoModelFromJson(jsonString);

import 'dart:convert';

UserInfoModel userInfoModelFromJson(String str) =>
    UserInfoModel.fromJson(json.decode(str));

String userInfoModelToJson(UserInfoModel data) => json.encode(data.toJson());


class UserListModel {
  List<UserInfoModel> list;
  UserListModel(this.list);

  factory UserListModel.fromJson(List<dynamic> list) {
    // 调用自身构造方法传值并返回
    return UserListModel(
      list.map((listItem) => UserInfoModel.fromJson(listItem)).toList(),
    );
  }
}

class UserInfoModel {
  UserInfoModel({
    this.id,
    this.name,
    this.gender,
    this.avatarUrl,
    this.bgUrl,
    this.phone,
    this.status,
    this.description,
    this.email,
    this.password,
    this.miniWeixinUnionId,
    this.miniWeixinOpenId,
    this.miniQqUnionId,
    this.miniQqOpenId,
    this.ipAddress,
    this.ipSource,
    this.country,
    this.province,
    this.birthday,
    this.city,
    this.university,
    this.followCount,
    this.fansCount,
    this.letterUnread,
    this.commentUnread,
    this.atUnread,
    this.notificationUnread,
    this.artistId,
    this.createTime,
    this.updateTime,
    this.hasFollowed,
  });

  int id;
  String name;
  int gender;
  String avatarUrl;
  String bgUrl;
  String phone;
  int status;
  String description;
  String email;
  String password;
  String miniWeixinUnionId;
  String miniWeixinOpenId;
  String miniQqUnionId;
  String miniQqOpenId;
  String ipAddress;
  String ipSource;
  String country;
  String province;
  String birthday;
  String city;
  String university;
  int followCount;
  int fansCount;
  int letterUnread;
  int commentUnread;
  int atUnread;
  int notificationUnread;
  int artistId;
  DateTime createTime;
  DateTime updateTime;
  dynamic hasFollowed;

  factory UserInfoModel.fromJson(Map<String, dynamic> json) => UserInfoModel(
        id: json["id"],
        name: json["name"],
        gender: json["gender"],
        avatarUrl: json["avatarUrl"],
        bgUrl: json["bgUrl"],
       phone: json["phone"] == null ? null :json["phone"],
        status: json["status"],
        description: json["description"],
         email:json["email"] == null ? null :json["email"],
       password: json["password"] == null ? null :json["password"],
        birthday: json["birthday"],
        miniWeixinUnionId: json["miniWeixinUnionId"],
        miniWeixinOpenId: json["miniWeixinOpenId"],
        miniQqUnionId: json["miniQqUnionId"],
        miniQqOpenId: json["miniQqOpenId"],
        ipAddress: json["ipAddress"],
        ipSource: json["ipSource"],
        country: json["country"],
        province: json["province"],
        city: json["city"],
        university: json["university"],
        followCount: json["followCount"],
        fansCount: json["fansCount"],
        letterUnread: json["letterUnread"],
        commentUnread: json["commentUnread"],
        atUnread: json["atUnread"],
        notificationUnread: json["notificationUnread"],
        artistId: json["artistId"],
        createTime: DateTime.parse(json["createTime"]),
        updateTime: DateTime.parse(json["updateTime"]),
        hasFollowed: json["hasFollowed"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "name": name,
        "gender": gender,
        "avatarUrl": avatarUrl,
        "bgUrl": bgUrl,
        "phone": phone== null ? null :  phone,
        "status": status,
        "description": description,
        "email": email== null ? null :  email,
        "password": password== null ? null :  password,
        "birthday": birthday,
        "miniWeixinUnionId": miniWeixinUnionId,
        "miniWeixinOpenId": miniWeixinOpenId,
        "miniQqUnionId": miniQqUnionId,
        "miniQqOpenId": miniQqOpenId,
        "ipAddress": ipAddress,
        "ipSource": ipSource,
        "country": country,
        "province": province,
        "city": city,
        "university": university,
        "followCount": followCount,
        "fansCount": fansCount,
        "letterUnread": letterUnread,
        "commentUnread": commentUnread,
        "atUnread": atUnread,
        "notificationUnread": notificationUnread,
        "artistId": artistId,
        "createTime": createTime.toIso8601String(),
        "updateTime": updateTime.toIso8601String(),
        "hasFollowed": hasFollowed,
      };
}
